<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/barse.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/style.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/purebox.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/quickLinks.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/user.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/js/layer/skin/layer.css" />
		<link rel="stylesheet" type="text/css" href="__STATIC__/ecshop/css/sweetalert/sweetalert.css" />
		<script src="__STATIC__/ecshop/js/jquery-2.1.0.js"></script>
		<script src="__STATIC__/ecshop/js/layer/layer.min.js"></script>
		<script src="__STATIC__/ecshop/js/sweetalert/sweetalert.min.js"></script>
		<script src="__STATIC__/ecshop/js/laydate/laydate.js"></script>
		<style type="text/css">
			.active {
				color: #0071CE;
				border-bottom: 1px solid #0071CE;
			}
			
			.activeA {
				display: block;
			}
			
			.inline {
				display: inline-block;
				padding: 5px;
			}
			
			.textRed {
				color: red;
			}
			
			.table-bordered {
				border: 1px solid #EBEBEB;
			}
			
			.table-bordered>thead>tr>th,
			.table-bordered>thead>tr>td {
				background-color: #F5F5F6;
				border-bottom-width: 1px;
			}
			
			.table-bordered>thead>tr>th,
			.table-bordered>tbody>tr>th,
			.table-bordered>tfoot>tr>th,
			.table-bordered>thead>tr>td,
			.table-bordered>tbody>tr>td,
			.table-bordered>tfoot>tr>td {
				border: 1px solid #e7e7e7;
			}
			
			.table>thead>tr>th {
				border-bottom: 1px solid #DDDDDD;
				vertical-align: bottom;
			}
			
			.table>thead>tr>th,
			.table>tbody>tr>th,
			.table>tfoot>tr>th,
			.table>thead>tr>td,
			.table>tbody>tr>td,
			.table>tfoot>tr>td {
				border-top: 1px solid #e7eaec;
				line-height: 1.42857;
				padding: 8px;
				vertical-align: middle;
				text-align: center;
			}
		</style>
	</head>

	<body>
		<div class="user-main" ectype="userMain">
			<div class="user-crumbs hide">
				<span><a href=".">首页</a></span><span class="arrow">&gt;</span> <span class="finish">进入会员中心</span> </div>

			<div class="user-mod" style="min-height: 1076px;margin:0 auto">
				<div class="user-title">
					<h2>我的采购订单</h2>
					<ul class="tabs">
						<li class="user-count  active" >
							<a href="javascript:;">订单详情</a>
						</li>
						
					</ul>
				</div>
				
				<div id="user_order_list">
					<div class="user-order-list">
						<form class="layui-form" id="form1">
							<div class="mr15 inline">
								<span>客户名称：</span>
								<span>{$order.khmc}</span>
								
							</div>
							<div class="mr15 inline">
								<span>开发票类型：</span>
								<input type="radio" name="fpType" id="" checked value="1" />普通发票
							</div><br />
							<div class="mr15 inline">
								<label>建议发货日期<span class="textRed">*</span>：</label>
								{$order.jyfhrq}
							</div><br />
							<div class="mr15 inline">
								<span>&nbsp;渠道优惠政策：</span>
								<select name="yhPolicy" style="padding: 4px 10px;" disabled>
									<option value="0">--请选择--</option>
									{volist name="yhlist" id="row"}
									<option value="{$row.id}" {if $order.yhPolicy==$row.id} selected {/if}>{$row.title}</option>
									{/volist}
								</select>

							</div><br />
							<div class="mr15 inline">
								<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;收货地址：</span>
								{$order.shdz}
							</div><br />
							<div class="mr15 inline">
								<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;收货人：</span>
								{$order.shr}
							</div><br />
							<div class="mr15 inline">
								<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;电话：</span>
								{$order.dh}
							</div>
							<div style="width: 100%;overflow-x: auto;padding: 20px 0;">
								<table class="table table-bordered" width="840" style="white-space: nowrap;">
									<thead>
										<tr>
											<th>明细编号</th>
											
											<th>品类</th>
											<th>产品编码</th>
											<th>产品名称</th>
											<th>对应订单<br />明细编号</th>
											<th>对应核销单<br />明细编号</th>
											<th>规格</th>
											<th>条形码</th>
											<th>单位</th>
											<th>原供价(元)</th>
											<th>现供价(元)</th>
											<th>类型</th>
											<th>订货数量</th>
											<th>搭赠数量</th>
											<th>原金额(元)</th>
											<th>应收金额(元)</th>
											<th>体积(立方米)</th>
											<th>重量(吨)</th>
											<th>备注</th>
										</tr>
									</thead>
									<tbody>
										 {if isset($data)}
            {volist name="data.list" id="row"}
            <tr>
                <td>
                    {$row.mxbh}
                </td>
              
                <td>
                    {$row.category}
                </td>
                <td>
                    {$row.prod_sn}
                </td>
                <td>
                    {$row.prod_name}
                </td>
                <td>
                    {$row.order_sn}
                </td>
                <td>
                    {$row.order_sn}
                </td>
                <td>
                    {$row.format}
                </td>
                <td>
                    {$row.pro_sku}
                </td>
                <td>
                    {$row.unit}
                </td>
                <td>
                    {$row.ygj}
                </td>
                <td>
                    {$row.xgj}
                </td>
                <td>
                    {if $row.xslx==1}销售{elseif $row.xslx==2}搭赠{elseif $row.xslx==3}货补{elseif $row.xslx==4}补费{/if}
                </td>
                <td>
                    {$row.num}
                </td>
                <td>
                    {$row.dzsl}
                </td>
                <td>
                    {$row.yje}
                </td>
                <td>
                    {$row.ysje}
                </td>
                <td>{$row.box_volume}</td>
                <td>{$row.weight}</td>
                <td>{$row.beizhu}</td>
            </tr>
            {/volist}
            {volist name="data.huobu" id="row"}
            <tr>
                <td>
                    {$row.mxbh}
                </td>
                
                <td>
                    {$row.category}
                </td>
                <td>
                    {$row.prod_sn}
                </td>
                <td>
                    {$row.prod_name}
                </td>
                <td>
                    {$row.order_sn}
                </td>
                <td>
                    {$row.order_sn}
                </td>
                <td>
                    {$row.format}
                </td>
                <td>
                    {$row.pro_sku}
                </td>
                <td>
                    {$row.unit}
                </td>
                <td>
                    {$row.yje}
                </td>
                <td>{$row.ysje}
                </td>
                <td>
                    补货
                </td>
                <td>{$row.num}</td>
                <td></td>
                <td>{$row.yje}</td>
                <td>{$row.ysje}</td>
                <td>{$row.box_volume}</td>
                <td>{$row.weight}</td>
                <td>{$row.beizhu}</td>
            </tr>
            {/volist}
            {/if}
            <tr>
                <td>
                </td>
                <td colspan="7" class="text-right text-bold">小计：</td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td>{if isset($zj1)}{$zj1}{/if}</td>
                <td>{if isset($zj2)}{$zj2}{/if}</td>
                <td>{if isset($zj3)}{$zj3}{/if}</td>
                <td>{if isset($zj4)}{$zj4}{/if}</td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            </tbody>
        </table>
{if isset($data.bufei)&&count($data.bufei)>0}
        <table class="table table-striped table-bordered text-center ad_table">
            <thead>
            <tr class="info">
                <th colspan="7" class="text-center font-bold">补费明细</th>
            </tr>
            <tr class="info">
                <th>明细编号</th>
                <th>操作</th>
                <th>对应核销单编号</th>
                <th>类型</th>
                <th>补费金额(元)</th>
                <th>应收金额(元)</th>
                <th>备注</th>
            </tr>
            </thead>
            <tbody>

            {volist name="data.bufei" id="row"}
            <tr>
                <td>
                    {$row.mxbh}
                </td>
               
                <td>
                    <a href="{:url('Tihexiao/view',['id'=>$row.hxdmxbh])}" class="J_menuItem">{$row.hxdbh}</a>
                </td>
                <td>
                    补费
                </td>
                <td>
                    {$row.bfje}
                </td>
                <td>
                    -{$row.bfje}
                </td>
                <td>
                    {$row.beizhu}
                </td>
            </tr>
            {/volist}

            <tr>
                <td>

                </td>
                <td colspan="3">

                </td>
                <td>
                    {if isset($xj)}{$xj}{/if}
                </td>
                <td>
                    -{if isset($xj)}{$xj}{/if}
                </td>
                <td>
                </td>
            </tr>
            </tbody>
        </table>
        {/if}
								</table>
							</div>
							<div class="mr15 inline" style="font-weight: bold;padding: 20px 0;">
								<span>订单总应收金额：</span>
								<span>{$order.yszje}</span>
							</div><br />
							<div class="mr15 inline" style="font-weight: bold;">
								<span>注意事项<span class="textRed">*</span>：</span>
								<textarea name="" rows="5" cols="60" disabled style="-ms-user-select:none">{$order.zysx}</textarea>
							</div><br />
							
							
							
							<div class="mr15 inline">
								
							</div><br />
							
						</form>
					</div>
				</div>
			</div>
			<script type="text/javascript">
			 $("#addsall").click(function () {
			        if ($("[name=cusName]").val() == "") {
			            swal("", "客户名称不能为空！", "error")
			        }   else if ($("[name=shdz]").val() == "") {
			            swal("", "收货地址不能为空！", "error")
			        } else if ($("[name=shr]").val() == "") {
			            swal("", "收货人不能为空！", "error")
			        } else if ($("[name=dh]").val() == "") {
			            swal("", "电话不能为空！", "error")
			        } else {
			            var jxs_id = $('[name=cusName]').val()
			            var yhPolicy = $('[name=yhPolicy]').val()
			            layer.open({
			                type: 2,
			                title: '添加销售订单明细',
			                skin: 'layui-layer-rim', //加上边框
			                area: ['900px', '500px'], //宽高
			                maxmin:true,
			                content: '{:url("add_Dd_detail")}?jxs_id='+jxs_id
			            });
			        }
			    })
				$(function() {
					$('.tabs .user-count').hover(function() {
						var $this = $(this);
						// 切换选中的 tab 项
						$(this).addClass('active').siblings('.tabs .user-count').removeClass('active');
						// 切换选中的 tab 对应的内容
					})
				})

				laydate.render({
					elem: '#fahuoDate'
				});
				
				
				
				
				
				/*添加销售订单明细弹出框*/
			  function 	layOpen(){
			  	layer.open()
			  }
			  $('[name=yhPolicy]').change(function(){
			  	qudaoyouhuipipei();
			  })
			  function qudaoyouhuipipei(){
			    //获取订单号，渠道号
			    var oid=$("#id").val();
			    var qid=$("[name='yhPolicy']").val();
			    if(oid!=""){
			    	if(qid!=0){
			    		$.post('{:url("qdyhzcxz")}',{qdyh_id:qid,order_id:oid},function (data) {
			                data=JSON.parse(data)
			                 if(data.success){
			                        location.reload()
			                    }
			                    //alert(data)
			                })
			    	}else{
			    		clearyh();
			    	}
			        
			    }
			}

//取消优惠
function clearyh(){
    //alert(1)
    var oid=$("#id").val();
    if(oid!=""){
        $.post('{:url("clearyh")}',{oid:oid},function(data){
            //alert(data);
            data=JSON.parse(data)
                 if(data.success){
                        location.reload()
                    }
        })
    }
}
  //删除
    $('.shanchu').on('click',function () {
        var link = $(this).data('link')
        $.post(link,function (data) {
            if(data.success){
                swal({title:data.msg},function () {
                    var oid=$("#id").val();
                    var qid=$("[name='yhPolicy']").val();
                    if(oid!=""&&qid!=""){
                        $.post('{:url("qdyhzcxz")}',{qdyh_id:qid,order_id:oid})
                    }
                        //
                    location.reload()
                })
            }else{
                swal(data.msg)
            }
        },'json')
    })
     //修改
    $('.xiugai').on('click',function () {
        var link = $(this).data('link')
        var jxs_id = $('input[name=cusName]').val()
        layer.open({
            type: 2,
            title: '修改明细',
            skin: 'layui-layer-rim', //加上边框
            area: ['800px', '500px'], //宽高
            content: link+'?jxs_id='+jxs_id
        });
    })
				/*添加货补订单明细弹出框*/
				/*添加补费订单明细弹出框*/
			</script>
	</body>

</html>